<template>
	<view class="foodpage">
		
		<!-- 轮播 -->
		<view class="top">
			<swiper class="swiper" circular  autoplay="true" indicator-dots interval="2000"	>
						<swiper-item>
							<view class="swiper-item">
								<image src="/static/image/banner-1-https://changban.dianjingkeji.net/img/banner-1-拷贝.jpg/banner-1-https://changban.dianjingkeji.net/img/banner-1-拷贝.jpg.jpg" mode=""></image>
								<view class="databox">
									<view class="boxtitle">
										膳食智商
									</view>
									<view class="line"></view>
									<view class="boxbtn">
										查看
									</view>
								</view>
							</view>
						</swiper-item>
						<swiper-item>
							<view class="swiper-item">
								<image src="/static/image/banner-1-https://changban.dianjingkeji.net/img/banner-1-拷贝.jpg/banner-1-https://changban.dianjingkeji.net/img/banner-1-拷贝.jpg.jpg" mode=""></image>
								<view class="databox">
									<view class="boxtitle">
										膳食智商
									</view>
									<view class="line"></view>
									<view class="dataline">
										<view class="type">
											A+
										</view>
										<view class="number">
											92
										</view>
										<view class="danwei">
											分
										</view>
									</view>
								</view>
							</view>
						</swiper-item>
					
						
						
					</swiper>
		</view>
		
		<view class="dateline">
			
		</view>
		<view class="datebox">
			<view class="databar">
				<view class="itemtab " :class="day==1?'tabact':''" @click="selecttab(1)">
					日
				</view>
				<view class="itemtab" :class="day==2?'tabact':''" @click="selecttab(2)">
					周
				</view>
				<view class="itemtab" :class="day==3?'tabact':''" @click="selecttab(3)">
					月
				</view>
			</view>
		</view>
		
		<view class="chartbox">
			<view class="titleline">
				<view class="left">
				  饮食代谢记录
				</view>
				
			</view>
			<view class="chart">
				<l-echart ref="chart1"></l-echart>
			</view>
		</view>
		<view class="chartbox" style="margin-top: 20rpx; ">
			<view class="titleline">
				<view class="left">
				  进食窗口
				</view>
				
			</view>
			<view class="chart">
				<l-echart ref="chart2"></l-echart>
			</view>
		</view>
		
		
		<view class="banner">
			<view class="outwin">
				<view class="topname">
					<view class="iconfont icon-jirou">
						
					</view>
					能量缺口
				</view>
				<view class="databox">
					<view class="dataview">
						<view class="datatitle">
							基础代谢
						</view>
						<view class="valuebox">
							<view class="value">
								1250
							</view>
							<view class="label">
								kcal
							</view>
						</view>
					</view>
					<view class="dataview">
						<view class="datatitle">
							热量缺口
						</view>
						<view class="valuebox">
							<view class="value">
								1250
							</view>
							<view class="label">
								kcal
							</view>
						</view>
					</view>
					
				</view>
				
			</view>
             <view  class="outwin">
             	<view class="inwin" @click="eatwin">
             		<view class="topname">
             			<view class="iconfont icon-shizhong ">
             				
             			</view>
             			进食窗口
             		</view>
             		<view class="dataline">
             			12  
             			<view class="danwei">
             				小时
             			</view>
             		</view>
             		<view class="dataline">
             			30 
             			<view class="danwei">
             				分
             			</view>
             		</view>
             	</view>
				<view class="inwin">
					<view class="topname" @click="myfood">
						<view class="iconfont icon-bingxiang">
							
						</view>
						我的食品库
					</view>
					<view class="dataline">
						12  
						<view class="danwei">
							小时
						</view>
					</view>
					<view class="dataline">
						30 
						<view class="danwei">
							分
						</view>
					</view>
				</view>
             </view>
		
		</view>
		
		
		
	
		

	


	
<!-- 	我的食品库 -->

<view class="foodkutitle">
	<view class="title">
	  饮食记录
	</view>
	
	
</view>


<view class="foodbox">
	<view class="titleline">
		<view class="left">
			早餐
		</view>
		<view class="lable">
			查看所有
		</view>
	</view>
	<view class="list">
		<view class="itemfood">
			<image src="/static/image/fd456a1456416.jpg" mode=""></image>
			<view class="itemname">
				土豆
			</view>
		</view>
		<view class="itemfood add" @click="addfood">
			<view class="iconfont icon-tianjia">
				
			</view>
		</view>
	</view>
</view>
<view class="foodbox">
	<view class="titleline">
		<view class="left">
			午餐
		</view>
		<view class="lable">
			查看所有
		</view>
	</view>
	<view class="list">
		<view class="itemfood">
			<image src="/static/image/fd456a1456416.jpg" mode=""></image>
			<view class="itemname">
				土豆
			</view>
		</view>
	</view>
</view>
<view class="foodbox">
	<view class="titleline">
		<view class="left">
			晚餐
		</view>
		<view class="lable">
			查看所有
		</view>
	</view>
	<view class="list">
		<view class="itemfood">
			<image src="/static/image/fd456a1456416.jpg" mode=""></image>
			<view class="itemname">
				土豆
			</view>
		</view>
	</view>
</view>
<view class="foodbox">
	<view class="titleline">
		<view class="left">
			加餐
		</view>
		<view class="lable">
			查看所有
		</view>
	</view>
	<view class="list">
		<view class="itemfood">
			<image src="/static/image/fd456a1456416.jpg" mode=""></image>
			<view class="itemname">
				土豆
			</view>
		</view>
	</view>
</view>
<view class="foodbox">
	<view class="titleline">
		<view class="left">
			零食
		</view>
		<view class="lable">
			查看所有
		</view>
	</view>
	<view class="list">
		<view class="itemfood">
			<image src="/static/image/fd456a1456416.jpg" mode=""></image>
			<view class="itemname">
				土豆
			</view>
		</view>
	</view>
</view>

	
	
	</view>
</template>

<script>
	 import lEchart from '../../pagesO/components/lime-echart/components/l-echart/l-echart.vue'
	export default {
		data() {
			return {
				day:1
			}
		},
		components:{
		lEchart	
		},
		mounted() {
			this.initChart1(),
			this.initChart2()
		},
		methods: {
			addfood(){
				uni.navigateTo({
					url:'/pagesA/changjing/changjing'
				})
			},
			eatwin(){
				uni.navigateTo({
				url:'/pagesA/eatwin/eatwin'
				})
			},
			myfood(){
				uni.navigateTo({
				url:'/pagesA/myfoods/myfoods'
				})
			},
			myrenwu(){
				uni.navigateTo({
					url:'/pagesA/renwulist/renwulist'
				})
			},
			selecttab(e){
				this.day=e
			},
			initChart1() {
					let option = {
						color: ['#5470C6', '#91CC75', '#EE6666', '#FAC858', '#73C0DE'],
				
						tooltip: {
							trigger: 'axis',
							axisPointer: {
								type: 'cross',
								label: {
									backgroundColor: '#283b56'
								}
							}
						},
						legend: {
							top:0
						},
						grid: {
							bottom: 10,
							left: 0,
							right: 20,
							containLabel: true
						},
						xAxis: [{
							type: 'category',
							data: [1,2,3,4,5,6,7],
							axisLine: {
								lineStyle: {
									color: '#999999'
								}
							},
							axisLabel: {
								color: '#666666'
							}
						}],
						yAxis: [{
							type: 'value',
							// 格式化标签，只显示整数
							axisLabel: {
								color: '#666666',
								formatter: function(value) {
									
									return Math.round(value);
								}
							}
						}],
						
						series:[
							 {
							    type: 'line',
							    data: [10,11,12,13,14,15,16]
							  }
						]
						
					}
			     
					this.$nextTick(() => {
						this.$refs.chart1.init(this.$echarts, chart1 => {
							chart1.setOption(option);
						});
					})
					},
					initChart2() {
							let option = {
							color: ['#5470C6', '#91CC75', '#EE6666', '#FAC858', '#73C0DE'],
						
								tooltip: {
									trigger: 'axis',
									axisPointer: {
										type: 'cross',
										label: {
											backgroundColor: '#283b56'
										}
									}
								},
								legend: {
									top:0
								},
								grid: {
									bottom: 10,
									left: 0,
									right: 20,
									containLabel: true
								},
								xAxis: [{
									type: 'category',
									data: [1,2,3,4,5,6,7],
									axisLine: {
										lineStyle: {
											color: '#999999'
										}
									},
									axisLabel: {
										color: '#666666'
									}
								}],
								yAxis: [{
									type: 'value',
									// 格式化标签，只显示整数
									axisLabel: {
										color: '#666666',
										formatter: function(value) {
											
											return Math.round(value);
										}
									}
								},
								{
									type: 'value',
									name:'kg',
									// 格式化标签，只显示整数
									axisLabel: {
										color: '#666666',
										formatter: function(value) {
											
											return Math.round(value);
										}
									}
								}],
							series:[
								 {
								    type: 'line',
								    data: [10,11,12,13,14,15,16]
								  }
							]
							}
					     
							this.$nextTick(() => {
								this.$refs.chart2.init(this.$echarts, chart2 => {
									chart2.setOption(option);
								});
							})
							},
		}
	}
</script>

<style lang="less" scoped>
.foodpage{
	width: 750rpx;
	box-sizing: border-box;
	background: #f2f2f2;
	padding-bottom: 200rpx;
	
	.top{
		width: 100%;
		height: 320rpx;
		box-sizing: border-box;
		background: linear-gradient(180deg, #F3EEFF  0%,rgba(255,255,255,1) 100%);
		.swiper{
			width: 100%;
			height: 100%;
			box-sizing: border-box;
			padding:0 20rpx ;
			.swiper-item{
				width:99.5%;
				height: 99%;
				border-radius: 30rpx;
				box-sizing: border-box;
				position: relative;
			
				image{
					width: 100%;
					height: 100%;
					border-radius: 30rpx;
				}
				.databox{
					position: absolute;
					left: 0;
					top: 0;
					width: 100%;
					height: 100%;
					color: white;
					box-sizing: border-box;
					padding-left: 40rpx;
					padding-top: 60rpx;
					.boxtitle{
						font-size: 40rpx;
					}
					.line{
						width: 80rpx;
						height: 4rpx;
						background-color: white;
						margin-top: 10rpx;
					}
					.boxbtn{
						width: 180rpx;
						height: 50rpx;
						line-height: 50rpx;
						text-align: center;
						background-color: white;
						font-size: 28rpx;
						font-weight: bold;
						border-radius: 25rpx;
						color: #a74cff;
						margin-top: 40rpx;
					}
					.dataline{
						display: flex;
						align-items: center;
						margin-top: 20rpx;
						.type{
							font-size: 70rpx;
							font-weight: bold;
							
						}
						.number{
							font-size: 70rpx;
							font-weight: bold;
							margin-left: 40rpx;
							
						}
						.danwei{
							
						}
						
					}
					
				}
			}
		}
	}
	.dateline{
		width: 100%;
		height: 120rpx;
		background-color: white;
	}
	.datebox{
		width: 100%;
		height: 180rpx;
		background-color: white;
		.databar{
			
			display: flex;
			align-items: center;
			width: 90%;
			height: 100rpx;
			margin: auto;
			border-radius: 20rpx;
			line-height: 100rpx;
			background-color:#e5e5e5;
			color: #656565;
			box-sizing: border-box;
			padding: 8rpx;
			justify-content: space-evenly;
			.itemtab{
				width: 32%;
				height: 100%;
				text-align: center;
				line-height: 90rpx;
			}
			.tabact{
				background-color: white;
				border-radius: 20rpx;
				font-weight:  bold;
			}
		}
	}
	
	.pagebtn{
		width: 160rpx;
		height: 160rpx;
		border-radius: 80rpx;
		background-color: rgba(228,228,228,0.72);
		position: fixed;
		box-shadow: 0pt 2pt 6pt 0pt rgba(0,0,0,0.17);
		top: 40vh;
		right: 30rpx;
		color: #1A4F8A;
		text-align: center;
		font-size: 42rpx;
		font-family: PingFangSC-regular;
		padding-top: 20rpx;
		box-sizing: border-box;
	   font-weight: 550;
	
	}
	.chartbox{
		width: 100%;
		height: 700rpx;
		background-color: white;
		box-sizing: border-box;
		padding: 30rpx;
		.chart{
			width: 700rpx;
			height: 600rpx;
		}
		.titleline{
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 30rpx;
			line-height: 30rpx;
			.left{
				border-left: 6rpx solid #a74cff;
			    font-size: 30rpx;
					font-weight: bold;
					padding-left: 14rpx;
					color: #575757 ;
			}
			
		}
	}
	.banner{
		width: 100%;
		 height: 400rpx;
		box-sizing: border-box;
		padding: 0 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 30rpx;
		
		.outwin{
			width:48%;
			height: 100%;
			background-color: white;
			border-radius: 20rpx;
			border-radius: 20rpx;
			box-sizing: border-box;
			padding: 30rpx;
			.inwin{
				width: 100%;
				height: 180rpx;
				background-color: white;
				border-radius: 20rpx;
				box-sizing: border-box;
				line-height: 1.5;
				padding: 30rpx;
				.topname{
					display: flex;
					align-items: center;
					font-weight: bold;
					margin-bottom: 0 !important;
					
					.iconfont{
						margin-right: 10rpx;
						font-size: 40rpx;
						color: #9E00FF;
					}
					
				}
				.dataline{
					display: flex;
					align-items: center;
					line-height: 1.5;
					font-weight: bold;
					.danwei{
						font-size: 28rpx;
						color: #BDBDBD ;
					}
				}
			}
			.topname{
				display: flex;
				align-items: center;
				font-weight: bold;
				margin-bottom: 40rpx;
				.iconfont{
					margin-right: 30rpx;
					font-size: 40rpx;
					
					color: #0BCBBF;
				}
				
			}
			.dataview{
				width: 50%;
			}
			.databox{
				
				line-height: 2.2;
				.valuebox{
					display: flex;
					align-items: center;
					.value{
						font-weight: bold;
					}
					.label{
						color: #BDBDBD;
						font-size: 28rpx;
					}
				}
			}
		}
	}
	
	
	

	.foodkutitle{
		display: flex;
		align-items: center;
		height: 32rpx;
		line-height: 32rpx;
		position: relative;
		margin: 50rpx 30rpx;
		.title{
			font-weight: bold;
			color: #3A3A3A ;
		}
		.line{
			width: 60rpx;
			height: 8rpx;
			position: absolute;
			border-radius: 4rpx;
				background-color:#9E00FF;
				left: 0;
				bottom: -3rpx;
		}
	}
	.foodbox{
		width: 100%;
		background-color: white;
		margin-top: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		.titleline{
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 30rpx;
			line-height: 30rpx;
			.left{
				border-left: 6rpx solid #a74cff;
			    font-size: 30rpx;
					font-weight: bold;
					padding-left: 14rpx;
					color: #575757 ;
			}
			.lable{
				font-size: 26rpx;
				color: gray;
				font-weight: bold;
			}
		}
		.list{
			width: 100%;
			 display: flex;
			 align-items: center;
			margin: 20rpx 0;
			.add{
				line-height: 210rpx;
				text-align: center;
				background-color: #BDBDBD;
				.iconfont{
					font-size: 50rpx;
					color: white;
				}
			}
			.itemfood{
				width: 310rpx;
				height: 210rpx;
				border-radius: 30rpx;
				position: relative;
				margin: 0 30rpx;
				image{
					width: 100%;
					height: 100%;
					border-radius: 30rpx;
				}
				.itemname{
					width: 100%;
					height: 42rpx;
					position: absolute;
					bottom: 0;
					left: 0;
					background-color: rgba(0, 0, 0, 0.5);
					color: white;
					border-bottom-left-radius: 30rpx;
					border-bottom-right-radius: 30rpx;
					text-align: center;
					line-height: 42rpx;
					font-size: 30rpx;
					
				}
			}
		}
	}
	
	
}
</style>
